<template>
    <div>
        <van-nav-bar :title="mtitle"
            left-text="返回"
            left-arrow
            @click-left="onClickLeft"
            fixed
        />
        
    </div>
</template>
<script>
export default {
    data() {
    return {
      mtitle:"",
      navbars: [
        {
          name: "GoodsManagerIndex",
          title: "商品列表",
          rightbutton:"exchange",
        },
        {
          name: "CartManagerIndex",
          title: "购物车列表",
          rightbutton:"",
        },
        {
          name: "OrderManagerIndex",
          title: "订单列表",
          rightbutton:"",
        },
        {
          name: "StaffManagerIndex",
          title: "我的个人中心",
          rightbutton:"",
        }
      ],
    };
  },
  methods: {},
  //通过路由跳转判断选中的样式
  created() {
      for( var i=0;i<this.navbars.length;i++){
          if(this.$route.name == this.navbars[i].name){
              this.mtitle=this.navbars[i].title;
          }
      }
  },
  methods:{
      onClickLeft(){
          this.$router.go(-1);
      },
  }
}
</script>